/*
 * Licensed to the Tai Ping Jin Ke
 *
 * Copyright (c) 2022 .
 * All rights reserved.
 * 项目名称：呼叫中心-通用处理层-任务调度
 * 版权说明：本软件属太平金融科技服务(上海)有限公司所有，在未获得太平金融科技服务(上海)有限公司正式授权情况下，任何企业和个人，不能获取、阅读、安装、传播本软件涉及的任何受知识产权保护的内容。
 */
package com.taiping.cc.job.converter;

import com.taiping.cc.job.dataobject.HttpResponseConfigDO;
import com.taipingframework.utility.http.ServiceConfigInfo.ServiceResponseConfigInfo;
import com.taipingframework.utility.http.constant.BatchReturnEnum;
import com.taipingframework.utility.http.constant.DataParseTypeEnum;
import com.taipingframework.utility.http.constant.ResponseBodyDataTypeEnum;

public class ServiceResponseConfigInfoConverter {

    /**
     * 数据对象 HttpResponseConfigDO 转 数据传输对象 ServiceResponseConfigInfo
     */
    public static ServiceResponseConfigInfo convert(HttpResponseConfigDO httpResponseConfig) {
        ServiceResponseConfigInfo serviceResponseConfigInfo = new ServiceResponseConfigInfo();
        if (httpResponseConfig == null) {
            return serviceResponseConfigInfo;
        }
        serviceResponseConfigInfo.setRootMapPath(httpResponseConfig.getRootMapPath());
        serviceResponseConfigInfo.setBatchReturn(BatchReturnEnum.get(httpResponseConfig.getBatchReturn()));
        serviceResponseConfigInfo.setCurrentPageKey(httpResponseConfig.getCurrentPageKey());
        serviceResponseConfigInfo.setTotalPageKey(httpResponseConfig.getTotalPageKey());
        serviceResponseConfigInfo.setStartPageNo(httpResponseConfig.getStartPageNo());
        serviceResponseConfigInfo.setDataParseType(DataParseTypeEnum.get(httpResponseConfig.getDataParseType()));
        serviceResponseConfigInfo.setResponseBodyDataType(ResponseBodyDataTypeEnum.get(httpResponseConfig.getResponseBodyDataType()));
        serviceResponseConfigInfo.setDecryptKey(httpResponseConfig.getDecryptKey());
        return serviceResponseConfigInfo;
    }

}
